package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.pokaYokeIdentifyPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName:pokaYokeIdentifyMapp
 * Description:
 *
 * @Author 赵永峰
 * @Create 2025/11/1 21:35
 * @Version 1.0
 */
@Mapper
public interface pokaYokeIdentifyMapp {
    //插入一条防错分析数据
    @DS("newMscLowCodeFormal")
    @Insert(
            "INSERT INTO ddm_poka_yoke_identify_list " +
                    "(id, create_time, update_time, creator, process_status, sys_update_user, sys_audit_user, sys_audit_time, " +
                    "sys_deleted, part_name, part_number, engine_model, workshop, lineName, op, " +
                    "failure_classification, poka_yoke_level, poka_yoke_type, failure_type, failure_description, " +
                    "poka_yoke_process_description, is_implement_poka_yoke, related_company_description, benchmark_description) " +
                    "VALUES ( " +
                    "#{id}, #{create_time}, #{update_time}, #{creator}, #{process_status}, #{sys_update_user}, " +
                    "#{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, #{part_name}, #{part_number}, " +
                    "#{engine_model}, #{workshop}, #{lineName}, #{op}, #{failure_classification}, " +
                    "#{poka_yoke_level}, #{poka_yoke_type}, #{failure_type}, #{failure_description}, " +
                    "#{poka_yoke_process_description}, #{is_implement_poka_yoke}, " +
                    "#{related_company_description}, #{benchmark_description})"
    )
    void insertOne(pokaYokeIdentifyPojo pojo);
    //多条件筛选防错分析表
    @DS("newMscLowCodeFormal")
    List<pokaYokeIdentifyPojo> filterPokaYok(String failureClassification, String partName, String pokaYokeLevel, String pokaYokeType, String engineType, String isFinish, String workshop, String lineName, String op, int startPage, int pageSize);
    //查未分页的总数
    @DS("newMscLowCodeFormal")
    Integer filterPokaYokTotal(String failureClassification, String partName, String pokaYokeLevel, String pokaYokeType, String engineType, String isFinish, String workshop, String lineName, String op);
    //修改一条防错数据
    @DS("newMscLowCodeFormal")
    @Update("UPDATE ddm_poka_yoke_identify_list SET " +
            "create_time = #{create_time}, " +
            "update_time = #{update_time}, " +  // 自动更新为当前时间
            "creator = #{creator}, " +
            "process_status = #{process_status}, " +
            "sys_update_user = #{sys_update_user}, " +
            "sys_audit_user = #{sys_audit_user}, " +
            "sys_audit_time = #{sys_audit_time}, " +
            "sys_deleted = #{sys_deleted}, " +
            "part_name = #{part_name}, " +
            "part_number = #{part_number}, " +
            "engine_model = #{engine_model}, " +
            "workshop = #{workshop}, " +
            "lineName = #{lineName}, " +
            "op = #{op}, " +
            "failure_classification = #{failure_classification}, " +
            "poka_yoke_level = #{poka_yoke_level}, " +
            "poka_yoke_type = #{poka_yoke_type}, " +
            "failure_type = #{failure_type}, " +
            "failure_description = #{failure_description}, " +
            "poka_yoke_process_description = #{poka_yoke_process_description}, " +
            "is_implement_poka_yoke = #{is_implement_poka_yoke}, " +
            "related_company_description = #{related_company_description}, " +
            "benchmark_description = #{benchmark_description} " +
            "WHERE id = #{id}")
    void editOneRow(pokaYokeIdentifyPojo pojo);
}
